<template>
  <div class="v-flow-config-section">
    <div class="config-section-title">优先级</div>
    <el-select v-model="sortNo" style="width: 240px">
      <el-option
        v-for="(item, i) in conditionNodes"
        :key="i"
        :label="`优先级${i + 1}`"
        :value="i"
      />
    </el-select>
  </div>
</template>

<script setup lang="ts">
import * as FlowPanel from '../../FlowPanel'
const { flowList } = inject<any>('flowTree', {
  flowList: []
})
const { currentNode } = inject<any>('drawer', {
  currentNode: FlowPanel.createNode()
})
const conditionNodes = computed(() => {
  return FlowPanel.findParentNode(flowList.value, currentNode.value)?.conditionNodes || []
})
const sortNo = ref<number>(0)
onMounted(() => {
  sortNo.value = conditionNodes.value.findIndex(
    (item: any) => item.nodeId === currentNode.value.nodeId
  )
})
</script>
